import type { Metadata } from "next";
import localFont from "next/font/local";
import "./globals.css";
import "./styles/scrollbar.scss";
import { redirect } from "next/navigation";
import { AntdRegistry } from "@ant-design/nextjs-registry";

const geistSans = localFont({
  src: "./fonts/GeistVF.woff",
  variable: "--font-geist-sans",
  weight: "100 900",
});
const geistMono = localFont({
  src: "./fonts/GeistMonoVF.woff",
  variable: "--font-geist-mono",
  weight: "100 900",
});

export const metadata: Metadata = {
  title: "Create Next App",
  description: "Generated by create next app",
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  // 如果是根路径，重定向到 customer/home
  if (typeof window !== "undefined" && window.location.pathname === "/") {
    redirect("/customer/home");
  }
  // 实际上路由要根据是哪个链接来判断的
  return (
    <html lang="en">
      <body
        className={`${geistSans.variable} ${geistMono.variable} antialiased min-h-screen flex flex-col`}
      >
        <AntdRegistry>{children}</AntdRegistry>
      </body>
    </html>
  );
}
